home *** CD-ROM | disk | FTP | other *** search
/ Software USA 3 #11 / Software USA Volume 3.11.iso / mac / Education / MacAtoms / MacAtoms 3.2.0 / MacAtoms 3.2.0.rsrc / TEXT_2001_Color.txt < prev    next >
Text File  |  1993-05-30  |  1KB  |  84 lines

  1. %% Copyright Hilary D. Jones, 1989-1993
  2. /out {print flush} def
  3. (Setting up.\n) out
  4. /inFile (%stdin) (r) file def
  5. /getToken {inFile token pop} bind def
  6. /setXform {
  7.     getToken
  8.     72 div /z exch def
  9.     /tm matrix defaultmatrix def
  10.     0 1 3 {
  11.         dup tm exch get 100 mul z div round 100 div
  12.         tm 3 1 roll put
  13.     } for
  14.     tm setmatrix
  15. } bind def
  16. /getTypes { /numTypes getToken def } bind def
  17. /getRadii {
  18.     /radii numTypes array def
  19.     /diam numTypes array def
  20.     0 1 numTypes 1 sub { radii exch getToken put } for
  21.     0 1 numTypes 1 sub { diam exch dup radii exch get 2 mul 1 add put } for
  22. } bind def
  23. /getRow {
  24.     exch dup 3 -1 roll getToken put
  25. } bind def
  26. /getData {
  27.     dup diam exch get array
  28.     exch diam exch get 1 sub 0 exch 1 exch
  29.     {getRow } for
  30. } bind def
  31. /getPictures {
  32.     /idat numTypes array def
  33.     0 1 numTypes 1 sub {idat exch dup getData put} for
  34. } bind def
  35. /row {
  36.     idat aType get
  37.     nrow get
  38.     /nrow nrow 1 add def
  39. } bind def
  40. /border {
  41.     newpath
  42.     radii exch get dup dup 0 360 arc
  43.     closepath
  44. } bind def
  45. /pim {
  46.     gsave
  47.     translate
  48.     /aType exch def
  49.     aType border clip
  50.     /nrow 0 def
  51.     diam aType get dup
  52.     1
  53.     matrix
  54.     { row }
  55.     false
  56.     4
  57.     colorimage
  58.     grestore
  59. } bind def
  60. /plotOne {
  61.     getToken
  62.     dup radii exch get dup
  63.     getToken exch sub
  64.     exch getToken exch sub
  65.     pim
  66. } bind def
  67. /plotAtoms {
  68.     1 1 getToken {pop plotOne} for
  69. } bind def
  70. /doit {
  71.     gsave
  72.     setXform
  73.     getTypes
  74.     getRadii
  75.     (Transferring image data.\n) out
  76.     getPictures
  77.     (Rendering images\n) out
  78.     plotAtoms
  79.     grestore
  80.     flush
  81. } bind def
  82. (Setup complete\n) out
  83. doit
  84.